<?php
/**
 * Normal presence object. 
 * 
 * This object is used to get presence information from other users or update
 * logged user presence ifnromation
 * 
 * @package stanza.presence
 */
class Zend_Jabber_Stanza_Request_Presence_Normal extends Zend_Jabber_Stanza_Request_Presence_Abstract {
   /**
    * Create new empty presence object
    * 
    * @param Zend_Jabber_User $user Zend_Jabber user. If this argument is passed current user presence information will be update or else other users information will be requested 
    */
   public function __construct(Zend_Jabber_User $user = null) {
        parent::__construct();
        
        $presence = $this->dom->createElement('presence');
        
        if($user) {
            if($user->getShow() == '') {
                $show = $this->dom->createElement('show');
            } else {
                $show = $this->dom->createElement('show', $user->getShow());
            }
            $presence->appendChild($show);
            
            if($user->getStatus() == '') {
                $status = $this->dom->createElement('status');
            } else {
                $status = $this->dom->createElement('status', $user->getStatus());
            }
            $presence->appendChild($status);
            
            $priority = $this->dom->createElement('priority', $user->getPriority());
            $presence->appendChild($priority);
        }
        
        $this->dom->appendChild($presence);
    }

}
?>